import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);

const store = new Vuex.Store({
	state: {
		appTheme: uni.getStorageSync('theme').theme ? uni.getStorageSync('theme').theme : 'light',
		locales: uni.getStorageSync('locale').locale ? uni.getStorageSync('locale').locale : 'zh-CN'
	},
	getters: {
		theme(state) {
			return state.appTheme
		},
		locale(state) {
			return state.locales
		}
	},
	mutations: {
		TOGGLE_APP_THEME(state, theme) {
			console.log(theme)
			state.appTheme = theme
		},
		TOGGLE_APP_LOCALE(state, locale) {
			console.log(locale)
			state.locales = locale
		}
	}
})
export default store;
